@zonos/elements 1.3.165 → 1.3.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +60 -25
- package/dist/cjs/zonos-checkout.cjs.entry.js +6 -3
- package/dist/cjs/zonos-controller.cjs.entry.js +3 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.js +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +36 -23
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +24 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +6 -3
- package/dist/collection/components/common/zonos-banner/zonos-banner.js +1 -1
- package/dist/collection/components/common/zonos-notification/zonos-notification.js +1 -1
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +3 -3
- package/dist/collection/components/common/zonos-spinner/zonos-spinner.js +1 -1
- package/dist/collection/components/main/zonos-controller.js +3 -2
- package/dist/esm/index.js +7 -7
- package/dist/esm/zonos-cart-items_13.entry.js +60 -25
- package/dist/esm/zonos-checkout.entry.js +6 -3
- package/dist/esm/zonos-controller.entry.js +3 -2
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +1 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-6e864533.entry.js → p-0150bb1e.entry.js} +1 -1
- package/dist/zonos-elements/p-4508c22b.entry.js +1 -0
- package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
- package/dist/zonos-elements/p-68584880.entry.js +1 -0
- package/dist/zonos-elements/{p-1c850630.system.entry.js → p-82a0fcb7.system.entry.js} +1 -1
- package/dist/zonos-elements/p-8654b135.system.entry.js +1 -0
- package/dist/zonos-elements/{p-735d4097.system.entry.js → p-d0adc1b5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3c865c53.system.js → p-d9b0094e.system.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-18d23528.entry.js +0 -1
- package/dist/zonos-elements/p-9d53988d.system.entry.js +0 -1
- package/dist/zonos-elements/p-f9c2ff4c.entry.js +0 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -129,7 +129,7 @@ const getZonosQaUrl = () => {
|
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
131
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
132
|
-
const cdnUrl = "https://v1.3.
|
|
132
|
+
const cdnUrl = "https://v1.3.167.js.zonos.com";
|
|
133
133
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
134
134
|
if (!qaUrl &&
|
|
135
135
|
(cdnUrl.includes('test.') ||
|
|
@@ -313,10 +313,10 @@ const zonosLoadUrl = (() => {
|
|
|
313
313
|
}
|
|
314
314
|
return null;
|
|
315
315
|
})();
|
|
316
|
-
const ZONOS_URL = "https://v1.3.
|
|
317
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
318
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
319
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
316
|
+
const ZONOS_URL = "https://v1.3.167.js.zonos.com";
|
|
317
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.167";
|
|
318
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.167";
|
|
319
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.167";
|
|
320
320
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
321
321
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
322
322
|
class Zonos {
|
|
@@ -330,7 +330,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
|
|
|
330
330
|
!!window.location.search.match(/\?.*(&*)zonosConversionTest/);
|
|
331
331
|
Zonos._paypalMockResponse = null;
|
|
332
332
|
Zonos.isBigCommerce = false;
|
|
333
|
-
Zonos.releaseDate = "
|
|
333
|
+
Zonos.releaseDate = "1741302018777";
|
|
334
334
|
Zonos.isLegacyCheckout = false;
|
|
335
335
|
Zonos.domain = typeof window !== 'undefined'
|
|
336
336
|
? // domain that embeds the iframe
|
|
@@ -346,7 +346,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
|
|
|
346
346
|
Zonos.isNpm = true;
|
|
347
347
|
Zonos.zonosQaUrl = null;
|
|
348
348
|
Zonos.zonosQaUrlApi = null;
|
|
349
|
-
Zonos.version = `v${"1.3.
|
|
349
|
+
Zonos.version = `v${"1.3.167"}`;
|
|
350
350
|
Zonos.modeAlerted = false;
|
|
351
351
|
Zonos.cartData = null;
|
|
352
352
|
Zonos.paypal = null;
|
|
@@ -1328,8 +1328,29 @@ const ZonosCheckoutFinish = class {
|
|
|
1328
1328
|
this.shouldRenderCloseButtonForRedirectBehavior = () => {
|
|
1329
1329
|
return this.isRedirectBehavior() || this.notificationType === 'error';
|
|
1330
1330
|
};
|
|
1331
|
+
this.redirectToMerchantSuccessPage = () => {
|
|
1332
|
+
var _a, _b, _c, _d;
|
|
1333
|
+
const settingsRedirectUrl = cart.cartStore.externalConfirmationPageURL ||
|
|
1334
|
+
zonosStore.zonosStore.checkoutSettings.successRedirectUrl;
|
|
1335
|
+
const redirectUrl = settingsRedirectUrl;
|
|
1336
|
+
const queryParams = new URLSearchParams();
|
|
1337
|
+
const orderId = (_a = this.order) === null || _a === void 0 ? void 0 : _a.id;
|
|
1338
|
+
const legacyOrderNumber = ((_d = (_c = (_b = this.order) === null || _b === void 0 ? void 0 : _b.references) === null || _c === void 0 ? void 0 : _c.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _d === void 0 ? void 0 : _d.value) || null;
|
|
1339
|
+
if (orderId) {
|
|
1340
|
+
queryParams.set('zOrderNumber', orderId);
|
|
1341
|
+
}
|
|
1342
|
+
if (legacyOrderNumber) {
|
|
1343
|
+
queryParams.set('orderId', legacyOrderNumber);
|
|
1344
|
+
}
|
|
1345
|
+
const queryString = queryParams.toString();
|
|
1346
|
+
const hasQueryString = redirectUrl.includes('?');
|
|
1347
|
+
this.isWaitingToRedirect = true;
|
|
1348
|
+
this.redirectToUrl(queryString
|
|
1349
|
+
? // Some url already has query string, so we need to append the query string with '&' instead of '?'
|
|
1350
|
+
`${redirectUrl}${hasQueryString ? '&' : '?'}${queryString}`
|
|
1351
|
+
: redirectUrl);
|
|
1352
|
+
};
|
|
1331
1353
|
this.handleSuccessBehavior = async () => {
|
|
1332
|
-
var _a, _b;
|
|
1333
1354
|
/**
|
|
1334
1355
|
* Save placed order info so we can show order info if they try to place the order again
|
|
1335
1356
|
*/
|
|
@@ -1339,9 +1360,6 @@ const ZonosCheckoutFinish = class {
|
|
|
1339
1360
|
// If the merchant wants to redirect to a different page
|
|
1340
1361
|
case successBehavior === 'REDIRECT_TO_SUCCESS_PAGE':
|
|
1341
1362
|
case !!cart.cartStore.externalConfirmationPageURL: {
|
|
1342
|
-
const settingsRedirectUrl = cart.cartStore.externalConfirmationPageURL ||
|
|
1343
|
-
zonosStore.zonosStore.checkoutSettings.successRedirectUrl;
|
|
1344
|
-
const redirectUrl = settingsRedirectUrl;
|
|
1345
1363
|
// use different default notification message if we are redirecting to a different page
|
|
1346
1364
|
this.notificationTitle = cart.translate('Order complete!');
|
|
1347
1365
|
this.notificationMessages = [
|
|
@@ -1364,20 +1382,7 @@ const ZonosCheckoutFinish = class {
|
|
|
1364
1382
|
return;
|
|
1365
1383
|
}
|
|
1366
1384
|
this.isWaitingToRedirect = false;
|
|
1367
|
-
|
|
1368
|
-
const queryParams = new URLSearchParams();
|
|
1369
|
-
if (this.order.id) {
|
|
1370
|
-
queryParams.set('zOrderNumber', this.order.id);
|
|
1371
|
-
}
|
|
1372
|
-
if (legacyOrderNumber) {
|
|
1373
|
-
queryParams.set('orderId', legacyOrderNumber);
|
|
1374
|
-
}
|
|
1375
|
-
const queryString = queryParams.toString();
|
|
1376
|
-
const hasQueryString = redirectUrl.includes('?');
|
|
1377
|
-
this.redirectToUrl(queryString
|
|
1378
|
-
? // Some url already has query string, so we need to append the query string with '&' instead of '?'
|
|
1379
|
-
`${redirectUrl}${hasQueryString ? '&' : '?'}${queryString}`
|
|
1380
|
-
: redirectUrl);
|
|
1385
|
+
this.redirectToMerchantSuccessPage();
|
|
1381
1386
|
break;
|
|
1382
1387
|
}
|
|
1383
1388
|
case successBehavior === 'CLOSE_MODAL':
|
|
@@ -1627,17 +1632,25 @@ const ZonosCheckoutFinish = class {
|
|
|
1627
1632
|
}
|
|
1628
1633
|
render() {
|
|
1629
1634
|
const isTestMode = handleFetch.getIsTestMode();
|
|
1630
|
-
return (index.h(index.Host, { key: '
|
|
1635
|
+
return (index.h(index.Host, { key: 'afcb0314658af4d53e7d453415dd73fb01a8f162', class: "zonos--checkout-finish zonos--elements", style: {
|
|
1631
1636
|
'--zonos--border-radius': getBorderRadius.getBorderRadius({
|
|
1632
1637
|
overrideBorderStyle: this.borderRadius,
|
|
1633
1638
|
}),
|
|
1634
|
-
} }, !this.isLoading && (index.h("div", { key: '
|
|
1639
|
+
} }, !this.isLoading && (index.h("div", { key: '99b7b6c9dd0e0545d770e4d9ed54207f5c13fdfd', class: "zonos--finish-details" }, index.h("div", { key: '11d249514d0eef2f8419e66b1070a20e745b84fd', class: "zonos--group" }, this.notificationType === 'success' ? (index.h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (index.h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), index.h("zonos-text", { key: 'c8f52780e8ea76b5951aa4ad3dfc87c19acbfd1d', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), index.h("zonos-text", { key: '459d7c1a9bd6fd77cfda25e9500a89061874b58f', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (index.h(index.Fragment, null, message, index.h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (index.h("zonos-button", { key: '4e34926ba96975ceff18016eb6bcad1906f1c773',
|
|
1635
1640
|
// Only show loading spinner if it's not an error notification
|
|
1636
1641
|
loading: this.isWaitingToRedirect &&
|
|
1637
|
-
this.notificationType !== 'error', onClick: () =>
|
|
1638
|
-
|
|
1642
|
+
this.notificationType !== 'error', onClick: () => {
|
|
1643
|
+
var _a;
|
|
1644
|
+
// Trigger the redirect action if order is ready when user clicks the close button
|
|
1645
|
+
if ((_a = this.order) === null || _a === void 0 ? void 0 : _a.id) {
|
|
1646
|
+
this.redirectToMerchantSuccessPage();
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
this.closeClickHandler();
|
|
1650
|
+
}, size: "md", variant: "primary" }, cart.translate('Close'))), !window.Zonos.isLegacyCheckout &&
|
|
1651
|
+
this.shouldRenderKeepShoppingButton() && (index.h("zonos-button", { key: '836907a2a325d615d897e5292f086bf9111226ae', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
|
|
1639
1652
|
cart.cartStore.step === 'finish' &&
|
|
1640
|
-
this.notificationType === 'success' && (index.h("div", { key: '
|
|
1653
|
+
this.notificationType === 'success' && (index.h("div", { key: 'ea1b4dd65f89d3eaec6391b6e440ae8ca20d5bdb', class: "zonos--finish-button-wrapper" }, index.h("zonos-button", { key: '350ee6b7fe58ff5e7a1584989e2df13ce5d243c6', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), index.h("zonos-button", { key: 'd3578cef9a3f6cc69fff48ee412f7010d526c284', onClick: () => {
|
|
1641
1654
|
const isZonosDashboard = window.location.hostname.includes('dashboard.zonos.com');
|
|
1642
1655
|
this.redirectToUrl(isZonosDashboard
|
|
1643
1656
|
? '/orders/all'
|
|
@@ -1761,8 +1774,11 @@ const ZonosCheckoutPayment = class {
|
|
|
1761
1774
|
* handler for continue button click
|
|
1762
1775
|
*/
|
|
1763
1776
|
this.continueClickHandler = async ({ currencyCode, }) => {
|
|
1777
|
+
var _a;
|
|
1764
1778
|
if (!this.handleValidate()) {
|
|
1765
1779
|
this.showErrorBanner = true;
|
|
1780
|
+
// Attempt to submit the form so the missing input error will be shown in Stripe
|
|
1781
|
+
void ((_a = cart.stripeStore.stripeElements) === null || _a === void 0 ? void 0 : _a.submit());
|
|
1766
1782
|
setTimeout(() => {
|
|
1767
1783
|
var _a;
|
|
1768
1784
|
(_a = this.ele.querySelector('zonos-banner')) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
@@ -1776,8 +1792,27 @@ const ZonosCheckoutPayment = class {
|
|
|
1776
1792
|
paypal.submitGtag('zonos-checkout-payment-info');
|
|
1777
1793
|
this.continueClicked.emit();
|
|
1778
1794
|
};
|
|
1779
|
-
this.copyCardToClipboard = (cardNumber) => {
|
|
1780
|
-
|
|
1795
|
+
this.copyCardToClipboard = async (cardNumber) => {
|
|
1796
|
+
try {
|
|
1797
|
+
await navigator.clipboard.writeText(cardNumber);
|
|
1798
|
+
}
|
|
1799
|
+
catch (_a) {
|
|
1800
|
+
// Copy happens in the iframe and it's not allowed to copy to the clipboard
|
|
1801
|
+
const hiddenTextarea = document.createElement('textarea');
|
|
1802
|
+
hiddenTextarea.style.position = 'fixed';
|
|
1803
|
+
hiddenTextarea.style.left = '-1000px';
|
|
1804
|
+
hiddenTextarea.style.top = '-1000px';
|
|
1805
|
+
hiddenTextarea.style.width = '1px';
|
|
1806
|
+
hiddenTextarea.style.height = '1px';
|
|
1807
|
+
hiddenTextarea.value = cardNumber;
|
|
1808
|
+
hiddenTextarea.id = 'zonos-copy-card-number';
|
|
1809
|
+
document.body.appendChild(hiddenTextarea);
|
|
1810
|
+
hiddenTextarea.select();
|
|
1811
|
+
// Have to use deprecated method execCommand because it's the only way to copy to the clipboard in the iframe
|
|
1812
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
1813
|
+
document.execCommand('copy');
|
|
1814
|
+
document.body.removeChild(hiddenTextarea);
|
|
1815
|
+
}
|
|
1781
1816
|
window.Zonos.showNotification({
|
|
1782
1817
|
message: cart.translate('Card number copied to clipboard'),
|
|
1783
1818
|
timeout: 4000,
|
|
@@ -591,7 +591,8 @@ const ZonosCheckout = class {
|
|
|
591
591
|
this.placedOrderInfo = null;
|
|
592
592
|
// Redirect to the vendor store url if this is legacy checkout
|
|
593
593
|
if (this.isLegacyCheckout) {
|
|
594
|
-
const storeBaseUrl = (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl
|
|
594
|
+
const storeBaseUrl = ((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl) ||
|
|
595
|
+
zonosStore.zonosStore.onlineStoreSettings.url;
|
|
595
596
|
if (!storeBaseUrl) {
|
|
596
597
|
return;
|
|
597
598
|
}
|
|
@@ -697,7 +698,8 @@ const ZonosCheckout = class {
|
|
|
697
698
|
cartId: window.Zonos.cartId,
|
|
698
699
|
checkoutSessionBody: cart.getCheckoutSessionBody(),
|
|
699
700
|
href: window.location.href,
|
|
700
|
-
storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl
|
|
701
|
+
storeBaseUrl: ((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl) ||
|
|
702
|
+
zonosStore.zonosStore.onlineStoreSettings.url,
|
|
701
703
|
},
|
|
702
704
|
});
|
|
703
705
|
cart.cartStoreUpdateToErrorState({
|
|
@@ -1068,7 +1070,8 @@ const ZonosCheckout = class {
|
|
|
1068
1070
|
cart.cartStoreReset();
|
|
1069
1071
|
// redirect to vendor store url if this is legacy checkout.
|
|
1070
1072
|
if (window.Zonos.isLegacyCheckout && window.Zonos.cartData) {
|
|
1071
|
-
const storeBaseUrl = window.Zonos.cartData.storeBaseUrl
|
|
1073
|
+
const storeBaseUrl = window.Zonos.cartData.storeBaseUrl ||
|
|
1074
|
+
zonosStore.zonosStore.onlineStoreSettings.url;
|
|
1072
1075
|
if (window.parent) {
|
|
1073
1076
|
window.parent.location.href = storeBaseUrl;
|
|
1074
1077
|
}
|
|
@@ -307,7 +307,8 @@ const ZonosController = class {
|
|
|
307
307
|
successBehavior: shouldOverrideSuccessBehavior
|
|
308
308
|
? 'ZONOS_SUCCESS_PAGE'
|
|
309
309
|
: this.config.checkoutSettings.successBehavior, successRedirectUrl: shouldOverrideSuccessBehavior
|
|
310
|
-
? (_e = window.Zonos.cartData) === null || _e === void 0 ? void 0 : _e.storeBaseUrl
|
|
310
|
+
? ((_e = window.Zonos.cartData) === null || _e === void 0 ? void 0 : _e.storeBaseUrl) ||
|
|
311
|
+
(json === null || json === void 0 ? void 0 : json.onlineStoreSettings.url)
|
|
311
312
|
: this.config.checkoutSettings.successRedirectUrl
|
|
312
313
|
}) : undefined });
|
|
313
314
|
// load default setting if failed to load user settings
|
|
@@ -399,7 +400,7 @@ const ZonosController = class {
|
|
|
399
400
|
zonosStore.zonosStore.organizationName = organizationName;
|
|
400
401
|
}
|
|
401
402
|
render() {
|
|
402
|
-
return index.h(index.Host, { key: '
|
|
403
|
+
return index.h(index.Host, { key: '14d142f73eae70c229b638ef298e20c9c7c5713d', class: "zonos--elements" });
|
|
403
404
|
}
|
|
404
405
|
};
|
|
405
406
|
ZonosController.style = ZonosControllerStyle0;
|
|
@@ -429,7 +429,7 @@ export class ZonosAddressUpdateDialog {
|
|
|
429
429
|
"references": {
|
|
430
430
|
"SubmitEventData": {
|
|
431
431
|
"location": "local",
|
|
432
|
-
"path": "/home/runner/work/zonos-elements/zonos-elements/src/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.tsx",
|
|
432
|
+
"path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.tsx",
|
|
433
433
|
"id": "src/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.tsx::SubmitEventData"
|
|
434
434
|
}
|
|
435
435
|
}
|
|
@@ -73,8 +73,29 @@ export class ZonosCheckoutFinish {
|
|
|
73
73
|
this.shouldRenderCloseButtonForRedirectBehavior = () => {
|
|
74
74
|
return this.isRedirectBehavior() || this.notificationType === 'error';
|
|
75
75
|
};
|
|
76
|
+
this.redirectToMerchantSuccessPage = () => {
|
|
77
|
+
var _a, _b, _c, _d;
|
|
78
|
+
const settingsRedirectUrl = cartStore.externalConfirmationPageURL ||
|
|
79
|
+
zonosStore.checkoutSettings.successRedirectUrl;
|
|
80
|
+
const redirectUrl = settingsRedirectUrl;
|
|
81
|
+
const queryParams = new URLSearchParams();
|
|
82
|
+
const orderId = (_a = this.order) === null || _a === void 0 ? void 0 : _a.id;
|
|
83
|
+
const legacyOrderNumber = ((_d = (_c = (_b = this.order) === null || _b === void 0 ? void 0 : _b.references) === null || _c === void 0 ? void 0 : _c.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _d === void 0 ? void 0 : _d.value) || null;
|
|
84
|
+
if (orderId) {
|
|
85
|
+
queryParams.set('zOrderNumber', orderId);
|
|
86
|
+
}
|
|
87
|
+
if (legacyOrderNumber) {
|
|
88
|
+
queryParams.set('orderId', legacyOrderNumber);
|
|
89
|
+
}
|
|
90
|
+
const queryString = queryParams.toString();
|
|
91
|
+
const hasQueryString = redirectUrl.includes('?');
|
|
92
|
+
this.isWaitingToRedirect = true;
|
|
93
|
+
this.redirectToUrl(queryString
|
|
94
|
+
? // Some url already has query string, so we need to append the query string with '&' instead of '?'
|
|
95
|
+
`${redirectUrl}${hasQueryString ? '&' : '?'}${queryString}`
|
|
96
|
+
: redirectUrl);
|
|
97
|
+
};
|
|
76
98
|
this.handleSuccessBehavior = async () => {
|
|
77
|
-
var _a, _b;
|
|
78
99
|
/**
|
|
79
100
|
* Save placed order info so we can show order info if they try to place the order again
|
|
80
101
|
*/
|
|
@@ -84,9 +105,6 @@ export class ZonosCheckoutFinish {
|
|
|
84
105
|
// If the merchant wants to redirect to a different page
|
|
85
106
|
case successBehavior === 'REDIRECT_TO_SUCCESS_PAGE':
|
|
86
107
|
case !!cartStore.externalConfirmationPageURL: {
|
|
87
|
-
const settingsRedirectUrl = cartStore.externalConfirmationPageURL ||
|
|
88
|
-
zonosStore.checkoutSettings.successRedirectUrl;
|
|
89
|
-
const redirectUrl = settingsRedirectUrl;
|
|
90
108
|
// use different default notification message if we are redirecting to a different page
|
|
91
109
|
this.notificationTitle = translate('Order complete!');
|
|
92
110
|
this.notificationMessages = [
|
|
@@ -109,20 +127,7 @@ export class ZonosCheckoutFinish {
|
|
|
109
127
|
return;
|
|
110
128
|
}
|
|
111
129
|
this.isWaitingToRedirect = false;
|
|
112
|
-
|
|
113
|
-
const queryParams = new URLSearchParams();
|
|
114
|
-
if (this.order.id) {
|
|
115
|
-
queryParams.set('zOrderNumber', this.order.id);
|
|
116
|
-
}
|
|
117
|
-
if (legacyOrderNumber) {
|
|
118
|
-
queryParams.set('orderId', legacyOrderNumber);
|
|
119
|
-
}
|
|
120
|
-
const queryString = queryParams.toString();
|
|
121
|
-
const hasQueryString = redirectUrl.includes('?');
|
|
122
|
-
this.redirectToUrl(queryString
|
|
123
|
-
? // Some url already has query string, so we need to append the query string with '&' instead of '?'
|
|
124
|
-
`${redirectUrl}${hasQueryString ? '&' : '?'}${queryString}`
|
|
125
|
-
: redirectUrl);
|
|
130
|
+
this.redirectToMerchantSuccessPage();
|
|
126
131
|
break;
|
|
127
132
|
}
|
|
128
133
|
case successBehavior === 'CLOSE_MODAL':
|
|
@@ -372,17 +377,25 @@ export class ZonosCheckoutFinish {
|
|
|
372
377
|
}
|
|
373
378
|
render() {
|
|
374
379
|
const isTestMode = getIsTestMode();
|
|
375
|
-
return (h(Host, { key: '
|
|
380
|
+
return (h(Host, { key: 'afcb0314658af4d53e7d453415dd73fb01a8f162', class: "zonos--checkout-finish zonos--elements", style: {
|
|
376
381
|
'--zonos--border-radius': getBorderRadius({
|
|
377
382
|
overrideBorderStyle: this.borderRadius,
|
|
378
383
|
}),
|
|
379
|
-
} }, !this.isLoading && (h("div", { key: '
|
|
384
|
+
} }, !this.isLoading && (h("div", { key: '99b7b6c9dd0e0545d770e4d9ed54207f5c13fdfd', class: "zonos--finish-details" }, h("div", { key: '11d249514d0eef2f8419e66b1070a20e745b84fd', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: 'c8f52780e8ea76b5951aa4ad3dfc87c19acbfd1d', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: '459d7c1a9bd6fd77cfda25e9500a89061874b58f', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: '4e34926ba96975ceff18016eb6bcad1906f1c773',
|
|
380
385
|
// Only show loading spinner if it's not an error notification
|
|
381
386
|
loading: this.isWaitingToRedirect &&
|
|
382
|
-
this.notificationType !== 'error', onClick: () =>
|
|
383
|
-
|
|
387
|
+
this.notificationType !== 'error', onClick: () => {
|
|
388
|
+
var _a;
|
|
389
|
+
// Trigger the redirect action if order is ready when user clicks the close button
|
|
390
|
+
if ((_a = this.order) === null || _a === void 0 ? void 0 : _a.id) {
|
|
391
|
+
this.redirectToMerchantSuccessPage();
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
this.closeClickHandler();
|
|
395
|
+
}, size: "md", variant: "primary" }, translate('Close'))), !window.Zonos.isLegacyCheckout &&
|
|
396
|
+
this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: '836907a2a325d615d897e5292f086bf9111226ae', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
|
|
384
397
|
cartStore.step === 'finish' &&
|
|
385
|
-
this.notificationType === 'success' && (h("div", { key: '
|
|
398
|
+
this.notificationType === 'success' && (h("div", { key: 'ea1b4dd65f89d3eaec6391b6e440ae8ca20d5bdb', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '350ee6b7fe58ff5e7a1584989e2df13ce5d243c6', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'd3578cef9a3f6cc69fff48ee412f7010d526c284', onClick: () => {
|
|
386
399
|
const isZonosDashboard = window.location.hostname.includes('dashboard.zonos.com');
|
|
387
400
|
this.redirectToUrl(isZonosDashboard
|
|
388
401
|
? '/orders/all'
|
|
@@ -25,8 +25,11 @@ export class ZonosCheckoutPayment {
|
|
|
25
25
|
* handler for continue button click
|
|
26
26
|
*/
|
|
27
27
|
this.continueClickHandler = async ({ currencyCode, }) => {
|
|
28
|
+
var _a;
|
|
28
29
|
if (!this.handleValidate()) {
|
|
29
30
|
this.showErrorBanner = true;
|
|
31
|
+
// Attempt to submit the form so the missing input error will be shown in Stripe
|
|
32
|
+
void ((_a = stripeStore.stripeElements) === null || _a === void 0 ? void 0 : _a.submit());
|
|
30
33
|
setTimeout(() => {
|
|
31
34
|
var _a;
|
|
32
35
|
(_a = this.ele.querySelector('zonos-banner')) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
@@ -40,8 +43,27 @@ export class ZonosCheckoutPayment {
|
|
|
40
43
|
submitGtag('zonos-checkout-payment-info');
|
|
41
44
|
this.continueClicked.emit();
|
|
42
45
|
};
|
|
43
|
-
this.copyCardToClipboard = (cardNumber) => {
|
|
44
|
-
|
|
46
|
+
this.copyCardToClipboard = async (cardNumber) => {
|
|
47
|
+
try {
|
|
48
|
+
await navigator.clipboard.writeText(cardNumber);
|
|
49
|
+
}
|
|
50
|
+
catch (_a) {
|
|
51
|
+
// Copy happens in the iframe and it's not allowed to copy to the clipboard
|
|
52
|
+
const hiddenTextarea = document.createElement('textarea');
|
|
53
|
+
hiddenTextarea.style.position = 'fixed';
|
|
54
|
+
hiddenTextarea.style.left = '-1000px';
|
|
55
|
+
hiddenTextarea.style.top = '-1000px';
|
|
56
|
+
hiddenTextarea.style.width = '1px';
|
|
57
|
+
hiddenTextarea.style.height = '1px';
|
|
58
|
+
hiddenTextarea.value = cardNumber;
|
|
59
|
+
hiddenTextarea.id = 'zonos-copy-card-number';
|
|
60
|
+
document.body.appendChild(hiddenTextarea);
|
|
61
|
+
hiddenTextarea.select();
|
|
62
|
+
// Have to use deprecated method execCommand because it's the only way to copy to the clipboard in the iframe
|
|
63
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
64
|
+
document.execCommand('copy');
|
|
65
|
+
document.body.removeChild(hiddenTextarea);
|
|
66
|
+
}
|
|
45
67
|
window.Zonos.showNotification({
|
|
46
68
|
message: translate('Card number copied to clipboard'),
|
|
47
69
|
timeout: 4000,
|
|
@@ -382,7 +382,8 @@ export class ZonosCheckout {
|
|
|
382
382
|
this.placedOrderInfo = null;
|
|
383
383
|
// Redirect to the vendor store url if this is legacy checkout
|
|
384
384
|
if (this.isLegacyCheckout) {
|
|
385
|
-
const storeBaseUrl = (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl
|
|
385
|
+
const storeBaseUrl = ((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl) ||
|
|
386
|
+
zonosStore.onlineStoreSettings.url;
|
|
386
387
|
if (!storeBaseUrl) {
|
|
387
388
|
return;
|
|
388
389
|
}
|
|
@@ -488,7 +489,8 @@ export class ZonosCheckout {
|
|
|
488
489
|
cartId: window.Zonos.cartId,
|
|
489
490
|
checkoutSessionBody: getCheckoutSessionBody(),
|
|
490
491
|
href: window.location.href,
|
|
491
|
-
storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl
|
|
492
|
+
storeBaseUrl: ((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl) ||
|
|
493
|
+
zonosStore.onlineStoreSettings.url,
|
|
492
494
|
},
|
|
493
495
|
});
|
|
494
496
|
cartStoreUpdateToErrorState({
|
|
@@ -859,7 +861,8 @@ export class ZonosCheckout {
|
|
|
859
861
|
cartStoreReset();
|
|
860
862
|
// redirect to vendor store url if this is legacy checkout.
|
|
861
863
|
if (window.Zonos.isLegacyCheckout && window.Zonos.cartData) {
|
|
862
|
-
const storeBaseUrl = window.Zonos.cartData.storeBaseUrl
|
|
864
|
+
const storeBaseUrl = window.Zonos.cartData.storeBaseUrl ||
|
|
865
|
+
zonosStore.onlineStoreSettings.url;
|
|
863
866
|
if (window.parent) {
|
|
864
867
|
window.parent.location.href = storeBaseUrl;
|
|
865
868
|
}
|
|
@@ -101,7 +101,7 @@ export class ZonosBanner {
|
|
|
101
101
|
"references": {
|
|
102
102
|
"BannerIntent": {
|
|
103
103
|
"location": "local",
|
|
104
|
-
"path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-banner/zonos-banner.tsx",
|
|
104
|
+
"path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-banner/zonos-banner.tsx",
|
|
105
105
|
"id": "src/components/common/zonos-banner/zonos-banner.tsx::BannerIntent"
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -93,7 +93,7 @@ export class ZonosNotification {
|
|
|
93
93
|
},
|
|
94
94
|
"NotificationInit": {
|
|
95
95
|
"location": "local",
|
|
96
|
-
"path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-notification/zonos-notification.tsx",
|
|
96
|
+
"path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-notification/zonos-notification.tsx",
|
|
97
97
|
"id": "src/components/common/zonos-notification/zonos-notification.tsx::NotificationInit"
|
|
98
98
|
},
|
|
99
99
|
"NotificationItem": {
|
package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js
CHANGED
|
@@ -61,7 +61,7 @@ export class ZonosShippingRichRadio {
|
|
|
61
61
|
"references": {
|
|
62
62
|
"ShippingRichRadioItem": {
|
|
63
63
|
"location": "local",
|
|
64
|
-
"path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
|
|
64
|
+
"path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
|
|
65
65
|
"id": "src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx::ShippingRichRadioItem"
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -159,7 +159,7 @@ export class ZonosShippingRichRadio {
|
|
|
159
159
|
"references": {
|
|
160
160
|
"ShippingRichRadioItem": {
|
|
161
161
|
"location": "local",
|
|
162
|
-
"path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
|
|
162
|
+
"path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
|
|
163
163
|
"id": "src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx::ShippingRichRadioItem"
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -196,7 +196,7 @@ export class ZonosShippingRichRadio {
|
|
|
196
196
|
"references": {
|
|
197
197
|
"ShippingRichRadioItem": {
|
|
198
198
|
"location": "local",
|
|
199
|
-
"path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
|
|
199
|
+
"path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
|
|
200
200
|
"id": "src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx::ShippingRichRadioItem"
|
|
201
201
|
}
|
|
202
202
|
}
|
|
@@ -59,7 +59,7 @@ export class ZonosSpinner {
|
|
|
59
59
|
"references": {
|
|
60
60
|
"SpinnerColor": {
|
|
61
61
|
"location": "local",
|
|
62
|
-
"path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-spinner/zonos-spinner.tsx",
|
|
62
|
+
"path": "/home/runner/work/fe-3-zonos-elements/fe-3-zonos-elements/src/components/common/zonos-spinner/zonos-spinner.tsx",
|
|
63
63
|
"id": "src/components/common/zonos-spinner/zonos-spinner.tsx::SpinnerColor"
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -156,7 +156,8 @@ export class ZonosController {
|
|
|
156
156
|
successBehavior: shouldOverrideSuccessBehavior
|
|
157
157
|
? 'ZONOS_SUCCESS_PAGE'
|
|
158
158
|
: this.config.checkoutSettings.successBehavior, successRedirectUrl: shouldOverrideSuccessBehavior
|
|
159
|
-
? (_e = window.Zonos.cartData) === null || _e === void 0 ? void 0 : _e.storeBaseUrl
|
|
159
|
+
? ((_e = window.Zonos.cartData) === null || _e === void 0 ? void 0 : _e.storeBaseUrl) ||
|
|
160
|
+
(json === null || json === void 0 ? void 0 : json.onlineStoreSettings.url)
|
|
160
161
|
: this.config.checkoutSettings.successRedirectUrl
|
|
161
162
|
}) : undefined });
|
|
162
163
|
// load default setting if failed to load user settings
|
|
@@ -248,7 +249,7 @@ export class ZonosController {
|
|
|
248
249
|
zonosStore.organizationName = organizationName;
|
|
249
250
|
}
|
|
250
251
|
render() {
|
|
251
|
-
return h(Host, { key: '
|
|
252
|
+
return h(Host, { key: '14d142f73eae70c229b638ef298e20c9c7c5713d', class: "zonos--elements" });
|
|
252
253
|
}
|
|
253
254
|
static get is() { return "zonos-controller"; }
|
|
254
255
|
static get encapsulation() { return "shadow"; }
|
package/dist/esm/index.js
CHANGED
|
@@ -126,7 +126,7 @@ const getZonosQaUrl = () => {
|
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
128
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
129
|
-
const cdnUrl = "https://v1.3.
|
|
129
|
+
const cdnUrl = "https://v1.3.167.js.zonos.com";
|
|
130
130
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
131
131
|
if (!qaUrl &&
|
|
132
132
|
(cdnUrl.includes('test.') ||
|
|
@@ -310,10 +310,10 @@ const zonosLoadUrl = (() => {
|
|
|
310
310
|
}
|
|
311
311
|
return null;
|
|
312
312
|
})();
|
|
313
|
-
const ZONOS_URL = "https://v1.3.
|
|
314
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
315
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
316
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
313
|
+
const ZONOS_URL = "https://v1.3.167.js.zonos.com";
|
|
314
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.167";
|
|
315
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.167";
|
|
316
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.167";
|
|
317
317
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
318
318
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
319
319
|
class Zonos {
|
|
@@ -327,7 +327,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
|
|
|
327
327
|
!!window.location.search.match(/\?.*(&*)zonosConversionTest/);
|
|
328
328
|
Zonos._paypalMockResponse = null;
|
|
329
329
|
Zonos.isBigCommerce = false;
|
|
330
|
-
Zonos.releaseDate = "
|
|
330
|
+
Zonos.releaseDate = "1741302018777";
|
|
331
331
|
Zonos.isLegacyCheckout = false;
|
|
332
332
|
Zonos.domain = typeof window !== 'undefined'
|
|
333
333
|
? // domain that embeds the iframe
|
|
@@ -343,7 +343,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
|
|
|
343
343
|
Zonos.isNpm = true;
|
|
344
344
|
Zonos.zonosQaUrl = null;
|
|
345
345
|
Zonos.zonosQaUrlApi = null;
|
|
346
|
-
Zonos.version = `v${"1.3.
|
|
346
|
+
Zonos.version = `v${"1.3.167"}`;
|
|
347
347
|
Zonos.modeAlerted = false;
|
|
348
348
|
Zonos.cartData = null;
|
|
349
349
|
Zonos.paypal = null;
|